<AppCol
    noRoot
    {{#if repeaterIndex}}
    :visible="detailModel?.{{item.codeName}}?.visible"
    {{else}}
    :visible="store.detailModel.{{item.codeName}}.visible"
    {{/if}}
    :layoutOpts="{{> @macro/common/layoutPos.hbs layout=item.psLayout layoutPos=item.psLayoutPos}}">
    {{#if (neq item.contentType "REPEATER")}}
    <AppFormMdCtrl
        key="{{item.codeName}}"
        name="{{item.codeName}}"
        {{#if item.psSysCss}} 
        class="{{item.psSysCss.cssName}}" 
        {{/if}}
        {{#if (or item.width item.height)}}
        style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px;{{/if}}"
        {{/if}}
        entityCodeName="{{#if (and item.contentPSControl item.contentPSControl.psAppDataEntity)}}{{item.contentPSControl.psAppDataEntity.codeName}}{{/if}}"
        deKeyField="{{#if (and item.contentPSControl item.contentPSControl.psAppDataEntity)}}{{item.contentPSControl.psAppDataEntity.keyPSAppDEField.codeName}}{{/if}}"
        contentType="{{item.contentType}}"
        :context="store.context"
        :viewParams="store.viewParams"
        @component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }">
        <template v-slot:default="{ context, viewParams, handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
            <{{item.contentPSControl.psAppDataEntity.codeName}}{{item.contentPSControl.codeName}}{{#if (eq item.contentType 'FORM')}}Form{{else if (eq item.contentType 'LIST')}}MDCtrl{{/if}}
                name="{{item.contentPSControl.name}}"
                {{#if (eq item.contentType 'FORM')}}
                :actions="{
                    loadAction: 'GetTemp',
                    loadDraftAction: 'GetDraftTemp',
                    updateAction: 'UpdateTemp',
                    createAction: 'CreateTemp',
                    removeAction: 'RemoveTemp',
                }"
                {{else if (eq item.contentType 'LIST')}}
                :actions="{
                    loadDraftAction: 'GetDraftTemp',
                    updateAction: 'UpdateTemp',
                    createAction: 'CreateTemp',
                    removeAction: 'RemoveTemp',
                    fetchAction: 'FetchTempDefault',
                }"
                {{/if}}
                :autoLoad="true"
                :localMode="true"
                :openView="store.openView"
                :newView="store.newView"
                :context="context"
                :viewParams="viewParams"
                :closeView="store.closeView"
                :pLoadingHelper="store.loadingHelper"
                :pViewCtx="store.viewCtx"
                @ctrl-init="(name:string, ability:any) => { handleCtrlInit(name, ability) }"
                @ctrl-action="(name:string, action:any, data:any) => { handleCtrlAction(name, action, data) }"
                @ctrl-destroy="(name:string, data:any) => { handleCtrlDestroy(name, data) }"
            />
        </template>
    </AppFormMdCtrl>
    {{else}}
    <AppFormMdCtrlRepeater
        caption="{{item.caption}}"
        {{#if item.columnAlign}}
        columnAlign="{{item.columnAlign}}"
        {{/if}}
        name="{{item.name}}"
        :layoutOpts="{{> @macro/common/layoutPos.hbs layout=item.psLayout layoutPos=item.psLayoutPos}}"
        {{#if repeaterIndex}}
        :level="{{repeaterIndex}}"
        {{/if}}
        {{#and item.parent (eq item.parent.detailType 'MDCTRL') (eq item.parent.contentType 'REPEATER')}}
        :parentIndex="index"
        :parentData="data"
        :context="context"
        :viewParams="viewParams"
        :childrenDetailModel="detailModel?.{{item.codeName}}?.childrenDetailModel"
        {{else}}
        :parentData="store.data"
        :context="store.context"
        :viewParams="store.viewParams"
        :childrenDetailModel="store.detailModel.{{item.codeName}}.childrenDetailModel"
        {{/and}}
        {{#if item.psDEFormDetails}}
        :children="[
            {{#each item.psDEFormDetails as | formDetail |}}
            {{#unless formDetail.hidden}}
                {{#and (eq formDetail.detailType 'FORMITEM')}}
            { name: '{{lowerCase formDetail.codeName}}', type: 'FORMITEM', caption: '{{formDetail.caption}}' },
                {{/and}}
                {{#and (eq formDetail.detailType 'MDCTRL') (eq formDetail.contentType 'REPEATER')}}
            { name: '{{lowerCase formDetail.codeName}}', type: 'REPEATER', caption: '{{formDetail.caption}}' },
                {{/and}}
            {{/unless}}
            {{/each}}
        ]"
        {{/if}}
        mode="{{item.detailStyle}}"
        @component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }">
        {{#neq item.detailStyle 'STYLE2'}}
        <template #default="{ data, index, detailModel, context, viewParams, handleComponentAction }">
        {{/neq}}
        {{#each item.psDEFormDetails as | formDetail |}}
            {{#unless formDetail.hidden}}
            {{#if repeaterIndex}}
            {{> @macro/widgets/form-detail/include-form.hbs type=formDetail.detailType item=formDetail repeaterMode=true repeaterIndex=(add 1 repeaterIndex)}}
            {{else}}
            {{> @macro/widgets/form-detail/include-form.hbs type=formDetail.detailType item=formDetail repeaterMode=true repeaterIndex=1}}
            {{/if}}
            {{/unless}}
        {{/each}}
        {{#neq item.detailStyle 'STYLE2'}}
        </template>
        {{/neq}}
    </AppFormMdCtrlRepeater>
    {{/if}}
</AppCol>
